  let data = [6, 1, 1, 2, 1, 8, 5, 6, 10, 9, 10, 4];
let netData = [];

const net = (data) => {
    for (let i = 0, length = data.length - 2; i < length; i += 2) {
        if (i == 0) {
            let minTemp = Math.min(data[1], data[length + 1]);
            if (!netData[minTemp]) {
                netData[minTemp] = []
            }
            netData[minTemp].push({
                deltaX: (data[0] - data[length]) / (data[1] - data[length + 1]),
                Ymax: Math.max(data[1], data[length + 1]),
                Xmin: Math.min(data[0], data[length])
            })

        } else {
            console.log('ceshi',Math.max(data[i + 1], data[i + 3]), Math.min(data[i], data[i + 2]));
            let minTemp = Math.min(data[i + 1], data[i + 3]);
            if (!netData[minTemp]) {
                netData[minTemp] = []
            }

            netData[minTemp].push({
                deltaX: (data[i] - data[i + 2]) / (data[i + 1] - data[i + 3]),
                Ymax: Math.max(data[i + 1], data[i + 3]),
                Xmin: Math.min(data[i], data[i + 2])
            })
        }

    }

    return netData;
}




console.log(net(data))